<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
>
<head id="head">
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="stylesheet" th:href="@{/css/amazeui.min.css}"/>
    <link rel="stylesheet" th:href="@{/css/mystyle.css}"/>
</head>
<body>
<!-- 后台首页 -->
<div id="home">
    <div id="particles-js"></div>

    <!-- scripts -->
    <script th:src="@{js/particles.min.js}"></script>
    <script th:src="@{/js/application.js}"></script>

</div>

<!-- 添加用户页面 -->
<div id="addUser">
    <div class="admin-content-body">
        <div class="am-cf am-padding am-padding-bottom-0">
            <div class="am-fl am-cf">
                <strong class="am-text-primary am-text-lg">用户管理</strong> /
                <small>添加用户</small>
            </div>
        </div>

        <hr/>

        <div class="am-tabs am-margin" data-am-tabs="">
            <ul class="am-tabs-nav am-nav am-nav-tabs">
                <li sec:authorize="hasRole('SU')" class="am-active"><a href="#tab1">添加管理员</a></li>
                <li><a href="#tab2">添加企业用户</a></li>
                <li><a href="#tab3">添加毕业生</a></li>
            </ul>


            <div class="am-tabs-bd">
                <div sec:authorize="hasRole('SU')" class="am-tab-panel am-fade am-in am-active" id="tab1">
                    <form class="am-form" th:action="@{/admin/addAdminUser}" method="post">
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                管理员帐号
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input name="username" type="text" class="am-input-sm"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复(4~12位数字字母下划线)</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                管理员密码
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input name="password" type="text" class="am-input-sm"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复(6~18位任意字符)</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                确认密码
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*与输入密码一致</div>
                        </div>


                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                &nbsp;
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <button class="am-btn am-btn-primary am-btn-xs" type="submit">提交保存</button>
                                <button class="am-btn am-btn-warning am-btn-xs am-fr" type="reset">重置表单</button>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">&nbsp;</div>
                        </div>


                    </form>
                </div>

                <div class="am-tab-panel am-fade" id="tab2">
                    <form class="am-form" th:action="@{/admin/addCompany}" method="post">
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                企业帐号
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="user.username"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复(4~12位数字字母下划线)</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                密码
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="user.password"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复(6~18位任意字符)</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                确认密码
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*与输入密码一致</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                企业名称
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="companyname"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                企业地址
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="address"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                联系方式
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="telephone"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                        </div>

                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                &nbsp;
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <button class="am-btn am-btn-primary am-btn-xs" type="submit">提交保存</button>
                                <button class="am-btn am-btn-warning am-btn-xs am-fr" type="reset">重置表单</button>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">&nbsp;</div>
                        </div>


                    </form>
                </div>
                <div class="am-tab-panel am-fade" id="tab3">
                    <form class="am-form" th:action="@{/admin/addGdeUser}" method="post">
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                毕业生帐号
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="user.username"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复(4~12位数字字母下划线)</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                密码
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="user.password"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复(6~18位任意字符)</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                确认密码
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*与输入密码一致</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                毕业生姓名
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="name"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                毕业生性别
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <label class="am-radio-inline">
                                    <input type="radio"  checked="checked" name="sex" value="男" data-am-ucheck=""/> 男
                                </label>
                                <label class="am-radio-inline">
                                    <input type="radio" name="sex" value="女" data-am-ucheck=""/> 女
                                </label>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必选，不可重复</div>
                        </div>

                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                专业
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <select data-am-selected="{searchBox: 1,maxHeight: 135}" name="major.id">
                                    <!-- dropUp: 1 向上下拉框 -->
                                    <option  th:each="mj : ${majors}" th:value="${mj.id}" th:text="${mj.name}"></option>
                                </select>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必选，不可重复</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                班级
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="text" class="am-input-sm" name="clazz"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                手机号
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <input type="tel" class="am-input-sm" name="phone"/>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                        </div>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                备注
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <textarea rows="4" name="remark"></textarea>
                            </div>
                            <div class="am-hide-sm-only am-u-md-6">*选填</div>
                        </div>

                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                &nbsp;
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <button class="am-btn am-btn-primary am-btn-xs" type="submit">提交保存</button>
                                <button class="am-btn am-btn-warning am-btn-xs am-fr" type="reset">重置表单</button>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">&nbsp;</div>
                        </div>


                    </form>
                </div>
            </div>
        </div>
    </div>
    <script th:src="@{/js/jquery.min.js}"></script>
    <script type="text/javascript">
        $(function () {
            $("#user-nav").addClass("am-in");
        });
    </script>
</div>
<!--用户列表页面-->
<div id="userList">
    <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">表格</strong> /
            <small>Table</small>
        </div>
    </div>

    <hr/>

    <div class="am-g">
        <div class="am-u-sm-12 am-u-md-3 am-fr">
            <div class="am-input-group am-input-group-sm">
                <input type="text" class="am-form-field"/>
                <span class="am-input-group-btn">
            <button class="am-btn am-btn-default" type="button">搜索</button>
          </span>
            </div>
        </div>
    </div>
    <div class="am-g">
        <div class="am-u-sm-12">
            <form class="am-form">
                <table class="am-table am-table-striped am-table-hover table-main">
                    <thead>
                    <tr>
                        <th class="table-check"><input type="checkbox"/></th>
                        <th class="table-id">ID</th>
                        <th class="table-title">用户名</th>
                        <th class="table-type">角色</th>
                        <th class="table-date am-hide-sm-only">创建日期</th>
                        <th class="table-set">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="u : ${users}">

                        <th:block sec:authorize="hasRole('SU')">
                            <td><input type="checkbox"/></td>
                            <td th:text="${u.id}"></td>
                            <td><a href="#" th:text="${u.username}"></a> </td>
                            <td th:each="r : ${u.roles}"><span class="am-badge" th:text="${r.name}"></span></td>
                            <td class="am-hide-sm-only"
                                th:text="${#dates.format(u.createTime,'yyyy年MM月dd日 HH:mm:ss')}"></td>
                            <td>
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs">
                                        <button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span
                                                class="am-icon-pencil-square-o"></span> 编辑
                                        </button>
                                        <a href="javascript:;" th:href="@{'delUserById/' + ${u.roles[0].name } + '/' + ${u.id} }" class="delete am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span
                                                class="am-icon-trash-o"></span> 删除
                                        </a>
                                    </div>
                                </div>
                            </td>
                        </th:block>
                        <th:block sec:authorize="hasRole('ADMIN')" th:each="role : ${u.roles}">
                            <div th:if="not(${role.name eq 'ROLE_SU'} or ${role.name eq 'ROLE_ADMIN'})">
                                <td><input type="checkbox"/></td>
                                <td th:text="${u.id}"></td>
                                <td th:text="${u.username}"></td>
                                <td th:each="r : ${u.roles}"><span class="am-badge" th:text="${r.name}"></span></td>
                                <td class="am-hide-sm-only"
                                    th:text="${#dates.format(u.createTime,'yyyy年MM月dd日 hh:mm:ss')}"></td>
                                <td>
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span
                                                    class="am-icon-pencil-square-o"></span> 编辑
                                            </button>
                                            <a href="javascript:;" th:href="@{'delUserById/' + ${u.roles[0].name } + '/' + ${u.id} }" class="delete am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span
                                                    class="am-icon-trash-o"></span> 删除
                                            </a>
                                        </div>
                                    </div>
                                </td>
                            </div>
                        </th:block>
                    </tr>
                    </tbody>
                </table>
                <div class="am-cf">
                    <span sec:authorize="hasRole('SU')" th:text="'共' + ${#lists.size(users)} + '条记录'"></span>
                    <ul class="am-pagination am-pagination-centered">
                        <li class="am-disabled"><a href="#">«</a></li>
                        <li class="am-active"><a href="#">1</a></li>
                        <li><a href="#">2</a></li>
                        <li><a href="#">3</a></li>
                        <li><a href="#">4</a></li>
                        <li><a href="#">5</a></li>
                        <li><a href="#">»</a></li>
                    </ul>
                </div>
            </form>
        </div>
    </div>
<script src="/js/jquery.min.js"></script>
<script src="/js/layer.js"></script>
<script type="text/javascript">
    $(function () {
        $("#user-nav").addClass("am-in");
        $(".delete").click(function () {
            var url = this.href;
            layer.confirm('确认要删除吗?', {
                icon: 3, title: '提示', end: function (index) {
                    setTimeout(function () {
                        location.reload(true);
                    },300);
                }
            }, function (delconfirm) {
                $.post(url, {time: new Date().getTime()}, function (result) {
                    if (result == 0) {
                        layer.msg("删除成功");
                    } else {
                        layer.msg("删除失败!可能已被使用");
                    }
                });

                layer.close(delconfirm);
            });
            return false;
        });

    });
</script>
</div>
<!--公司列表页面-->
<div id="coms">
    <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">企业信息</strong> /
            <small>Table</small>
        </div>
    </div>

    <hr/>

    <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
            <div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                    <button id="addCom" type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</button>
                </div>
            </div>
        </div>

        <div class="am-u-sm-12 am-u-md-3 am-fr">
            <div class="am-input-group am-input-group-sm">
                <input type="text" class="am-form-field"/>
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" type="button">搜索</button>
                </span>
            </div>
        </div>
    </div>
    <div class="am-u-sm-12">
        <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
                <thead>
                <tr>
                    <th class="table-check"><input type="checkbox"/></th>
                    <th class="table-id">ID</th>
                    <th class="table-title">企业名称</th>
                    <th class="table-type">地址</th>
                    <th class="table-author am-hide-sm-only">联系方式</th>
                    <th class="table-title">企业账户</th>
                    <th class="table-set">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="c : ${coms}">
                    <td><input type="checkbox"/></td>
                    <td th:text="${c.id}"></td>
                    <td><a href="#" th:text="${c.companyname}"></a></td>
                    <td th:text="${c.address}"></td>
                    <td class="am-hide-sm-only" th:text="${c.telephone}"></td>
                    <td><a href="#" th:text="${c.user.username}"></a></td>
                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                <button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span
                                        class="am-icon-pencil-square-o"></span> 编辑
                                </button>

                                <a href="javascript:;" th:href="@{'delComByUserId/' + ${c.user.id}}"
                                   class="delete am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span
                                        class="am-icon-trash-o"></span> 删除
                                </a>
                            </div>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
            <div class="am-cf">
                <span th:text="'共' + ${#lists.size(coms)} + '条记录'"></span>
                <ul class="am-pagination am-pagination-centered">
                    <li class="am-disabled"><a href="#">«</a></li>
                    <li class="am-active"><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li><a href="#">5</a></li>
                    <li><a href="#">»</a></li>
                </ul>
            </div>
        </form>
    </div>
    <script src="/js/jquery.min.js"></script>
    <script src="/js/layer.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#company-nav").addClass("am-in");
            $(".delete").click(function () {
                var url = this.href;
                layer.confirm('确认要删除吗?', {
                    icon: 3, title: '提示', end: function (index) {
                        setTimeout(function () {
                            location.reload(true);
                        },300);
                    }
                }, function (delconfirm) {
                    $.post(url, {time: new Date().getTime()}, function (result) {
                        if (result == 0) {
                            layer.msg("删除成功");
                        } else {
                            layer.msg("删除失败!可能已被使用");
                        }
                    });

                    layer.close(delconfirm);
                });
                return false;
            });
            $("#addCom").click(function () {
                layer.open({
                    type: 2,
                    title: '添加企业',
                    maxmin: true,
                    shift: 1,
                    //  shadeClose: true, //点击遮罩关闭层
                    area: ['830px', '680px'],
                    scrollbar: false,
                    content: "/admin/addComPage",
                    end: function (index) {
                        setTimeout(function () {
                            location.reload(true);
                        },300);
                    }
                });
            });
        });
    </script>
</div>
<!-- 毕业生列表页面 -->
<div id="graduateList">
    <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">毕业生基本信息</strong> /
            <small>Table</small>
        </div>
    </div>

    <hr/>

    <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
            <div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                    <button id="addGdu" type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</button>
                </div>
            </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
            <div class="am-form-group">
                <select data-am-selected="{btnSize: 'sm'}">
                    <option value="option1">所有类别</option>
                    <option value="option2">求职中</option>
                    <option value="option2">求职成功</option>
                </select>
            </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3 am-fr">
            <div class="am-input-group am-input-group-sm">
                <input type="text" class="am-form-field"/>
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" type="button">搜索</button>
                </span>
            </div>
        </div>
    </div>
    <div class="am-u-sm-12">
        <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
                <thead>
                <tr>
                    <th class="table-check"><input type="checkbox"/></th>
                    <th class="table-id">ID</th>
                    <th class="table-title">毕业生姓名</th>
                    <th class="table-type">性别</th>
                    <th class="table-author am-hide-sm-only">联系方式</th>
                    <th class="table-type">专业</th>
                    <th class="table-type">班级</th>
                    <th class="table-type">求职状态</th>
                    <th class="table-type">备注</th>
                    <th class="table-author">毕业生帐号</th>
                    <th class="table-set">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="gd : ${gdList}">
                    <td><input type="checkbox"/></td>
                    <td th:text="${gd.id}"></td>
                    <td><a href="#" th:text="${gd.name}"></a></td>
                    <td th:text="${gd.sex}"></td>
                    <td class="am-hide-sm-only" th:text="${gd.phone}"></td>
                    <td th:text="${gd.major.name}"></td>
                    <td th:text="${gd.clazz}"></td>
                    <td th:text="${gd.jobStatus}"></td>
                    <td th:text="${#strings.abbreviate(gd.remark,11)}"></td>
                    <!--
                        #strings.abbreviate(object,maxsize) 限定字符串显示长度
                        如 #strings.abbreviate("thymeleaf",8)  ====  "thyme..."
                    -->
                    <td><a href="#" th:text="${gd.user.username}"></a></td>
                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                <button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span
                                        class="am-icon-pencil-square-o"></span> 编辑
                                </button>

                                <a href="javascript:;" th:href="@{'delGdu/' + ${gd.user.id}}"
                                   class="delete am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span
                                        class="am-icon-trash-o"></span> 删除
                                </a>
                            </div>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
            <div class="am-cf">
                <span th:text="'共' + ${#lists.size(gdList)} + '条记录'"></span>
                <ul class="am-pagination am-pagination-centered">
                    <li class="am-disabled"><a href="#">«</a></li>
                    <li class="am-active"><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li><a href="#">5</a></li>
                    <li><a href="#">»</a></li>
                </ul>
            </div>
        </form>
    </div>
    <script src="/js/jquery.min.js"></script>
    <script src="/js/layer.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".delete").click(function () {
                var url = this.href;
                layer.confirm('确认要删除吗?', {
                    icon: 3, title: '提示', end: function (index) {
                        setTimeout(function () {
                            location.reload(true);
                        },300);
                    }
                }, function (delconfirm) {
                    $.post(url, {time: new Date().getTime()}, function (result) {
                        if (result == 0) {
                            layer.msg("删除成功");
                        } else {
                            layer.msg("删除失败!可能已被使用");
                        }
                    });

                    layer.close(delconfirm);
                });
                return false;
            });


            $("#addGdu").click(function () {
                layer.open({
                    type: 2,
                    title: '添加企业',
                    maxmin: true,
                    shift: 1,
                    //  shadeClose: true, //点击遮罩关闭层
                    area: ['850px', '100%'],
                    scrollbar: false,
                    content: "/admin/addGduPage",
                    end: function (index) {
                        setTimeout(function () {
                            location.reload(true);
                        },300);
                    }
                });
            });

        });
    </script>
</div>
<!--专业列表-->
<div id="majorList">
    <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">专业管理</strong> /
            <small>Table</small>
        </div>
    </div>

    <hr/>

    <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
            <div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                    <button id="addMajor" type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span>
                        新增
                    </button>
                </div>
            </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3 am-fr">
            <div class="am-input-group am-input-group-sm">
                <input type="text" class="am-form-field"/>
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" type="button">搜索</button>
                </span>
            </div>
        </div>
    </div>
    <div class="am-u-sm-12">
        <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
                <thead>
                <tr>
                    <th class="table-check"><input type="checkbox"/></th>
                    <th class="table-id">ID</th>
                    <th class="table-title">专业名称</th>
                    <th>职位</th>
                    <th class="table-set">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="mj : ${majorList}" th:class="|mjTr${mj.id}|">
                    <td><input type="checkbox"/></td>
                    <td th:text="${mj.id}"></td>
                    <td th:text="${mj.name}"></td>
                    <td>
                        <th:block th:if="${#lists.size(mj.positions) le 3}" th:each="p : ${mj.positions}" th:text="${p.positionName}"></th:block>
                        <th:block th:if="${#lists.size(mj.positions) gt 3}">
                            <span th:text="${mj.positions[0].positionName}"></span>
                            <span th:text="${mj.positions[1].positionName}"></span>
                            <span th:text="${mj.positions[2].positionName}"></span>
                            <a href="javsscript:;">...</a>
                        </th:block>
                    </td>

                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                <button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span
                                        class="am-icon-pencil-square-o"></span> 编辑
                                </button>

                                <a th:href="@{'delMj/' + ${mj.id}}" th:alt="${mj.id}"
                                   class="delete am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span
                                        class="am-icon-trash-o"></span> 删除
                                </a>
                            </div>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
            <div class="am-cf">
                <ul class="am-pagination am-pagination-centered">
                    <li class="am-disabled"><a href="#">«</a></li>
                    <li class="am-active"><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li><a href="#">5</a></li>
                    <li><a href="#">»</a></li>
                </ul>
            </div>
        </form>

    </div>
    <script src="/js/jquery.min.js"></script>
    <script src="/js/layer.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#addMajor").click(function () {
                layer.open({
                    type: 2,
                    title: '添加专业',
                    maxmin: true,
                    shift: 1,
                  //  shadeClose: true, //点击遮罩关闭层
                    area: ['400px', '300px'],
                    scrollbar: false,
                    content: "/admin/addMajorPage",
                    end: function (index) {
                        setTimeout(function () {
                            location.reload(true);
                        },300);
                    }
                });
            });
            $(".delete").click(function () {
                var url = this.href;
                layer.confirm('确认要删除吗?', {
                    icon: 3, title: '提示', end: function (index) {
                       setTimeout(function () {
                           location.reload(true);
                       },300);
                    }
                }, function (delconfirm) {
                    $.post(url, {time: new Date().getTime()}, function (result) {
                        if (result == 0) {
                            layer.msg("删除成功");
                        } else {
                            layer.msg("删除失败!可能已被使用");
                        }
                    });

                    layer.close(delconfirm);
                });
                return false;
            });

        });

    </script>
</div>

</body>
</html>